   package test;

   import java.io.*;
   import java.util.*;

    public class compare
   {
       public static void main(String[] args) throws FileNotFoundException
      {
         try
         {
            Scanner s1 = new Scanner(new File("a.txt"));
            Scanner s2 = new Scanner(new File("b.txt"));     
            boolean same = true;
         
            while(true)
            {
               if(!s1.hasNextLine() && !s2.hasNextLine())
               {
                  same = true;
                  break;
               }
               else if(s1.hasNextLine() && !s2.hasNextLine() || !s1.hasNextLine() && s2.hasNextLine())
               {
                  same = false;
                  break;
               }
               else
               {
                  if(s1.next().equals(s2.next()))
                  {
                     same = true;
                  }
                  else
                  {
                     same = false;
                     break;
                  }
               }
            } 
            
            if(same)
               System.out.println("same");
            else
               System.out.println("not same");
         } 
             catch (Exception e)
            {
               System.out.println("not find");
            
            }
      
      }
   }
